package com.xxx.video.channel.adapters;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.xxx.video.R;
import com.xxx.video.channel.config.ChannelFragmentItemClickType;
import com.xxx.video.commen.adapters.BaseRecycleViewAdapter;
import com.xxx.video.commen.adapters.BaseViewHolder;

import butterknife.BindView;

public class HistoryChannelAdapter extends BaseRecycleViewAdapter<Object, HistoryChannelAdapter.MyHolder> {


    public HistoryChannelAdapter(@NonNull Context context) {
        super(context);
    }

    @Override
    public MyHolder onCreateDefaultViewHolder(View view, int viewType) {
        return new MyHolder(view);
    }

    @Override
    public int getItemLayout(int viewType) {
        return R.layout.item_history_channel;
    }

    @Override
    public int getItemCount() {
        return 1;
    }

    class MyHolder extends BaseViewHolder {
        @BindView(R.id.tv_item_history_channel_title)
        TextView tvItemHistoryChannelTitle;
        @BindView(R.id.rcv_item_history_channel_list)
        RecyclerView rcvItemHistoryChannelList;

        public MyHolder(View itemView) {
            super(itemView);
        }

        @Override
        public void setData2View(int position) {
            rcvItemHistoryChannelList.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));
            HistoryChannelListAdapter historyChannelListAdapter = new HistoryChannelListAdapter(context);
            rcvItemHistoryChannelList.setAdapter(historyChannelListAdapter);
        }
    }
}
